package org.thread.test04.demo04;

import java.util.concurrent.Callable;

/**
 * @author CSY
 * @date 2025 - 03 - 10
 */
public class MyCollable implements Callable<Integer> {

    private int startNum;
    private int endNum;

    public MyCollable(){}

    public MyCollable(int startNum, int endNum) {
        this.startNum = startNum;
        this.endNum = endNum;
    }

    @Override
    public Integer call() throws Exception {
        Integer sum = 0;
        for (Integer i = startNum; i <= endNum; i++) {
            sum += i;
        }
        return sum;
    }
}
